<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('创优创标')"/>
    <th:block th:include="include :: layout-latest-css"/>
    <th:block th:include="include :: ztree-css"/>
    <th:block th:include="include :: datetimepicker-css"/>
    <th:block th:include="include :: select2-css" />
</head>
<style>
    .search-collapse, .select-table {
        padding-top: 13px;
    }

    .select-list li p {
        margin: 7px 5px 5px 0px;
    }

    .table-striped .table > thead:first-child > tr:first-child > th {
        font-weight: normal;
        font-size: 13px;
        border: 1px solid #cccccc !important;
        border-right: 0px solid #cccccc !important;
    }

    .container-div {
        height: auto !important;
    }

    .sum {
        font-weight: 700;
        font-size: 14px;
        color: red;
        margin-top: 10px;
    }
</style>
<body class="gray-bg">
<div class="ui-layout-west">
    <div class="box box-main">
        <div class="box-header">
            <div class="box-title">
                <i class="fa icon-grid"></i> 项目名称
            </div>
            <div class="box-tools pull-right">
                <a type="button" class="btn btn-box-tool" href="#" onclick="project()" title="管理项目"><i
                        class="fa fa-edit"></i></a>
                <button type="button" class="btn btn-box-tool" id="btnExpand" title="展开" style="display:none;"><i
                        class="fa fa-chevron-up"></i></button>
                <button type="button" class="btn btn-box-tool" id="btnCollapse" title="折叠"><i
                        class="fa fa-chevron-down"></i></button>
                <button type="button" class="btn btn-box-tool" id="btnRefresh" title="刷新项目"><i
                        class="fa fa-refresh"></i></button>
            </div>
        </div>
        <div class="ui-layout-content">
            <div id="tree" class="ztree"></div>
        </div>
    </div>
</div>

<div class="ui-layout-center">
    <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="region-form">
                    <input type="hidden" id="companyId" name="companyId">
                    <input type="hidden" id="companyName" name="companyName">
                    <input type="hidden" id="proId" name="proId">
                    <input type="hidden" id="programId" name="programId">
                    <input type="hidden" id="programName" name="programName">
                    <div class="select-list">
                        <ul class="one">
                            <li>
                                <p style="width: 90px !important;">项目名称：</p>
                                <input type="text" class="form-control" name="programName" id="progName"
                                       autocomplete='off'/>
                            </li>

                            <li>
                                <p style="width: 90px !important;">创建月份：</p>
                                <input type="text" class="form-control" id="startTime" name="params[beginTime]"
                                       placeholder="开始月份"/>
                            </li>

                            <li>
                                <input type="text" class="form-control" id="endTime" name="params[endTime]"
                                       placeholder="结束月份"/>
                            </li>

                            <li style="margin-left: 50px">
                                <a class="btn btn-primary btn-rounded btn-sm search"
                                   onclick="searchList('administration-table')"><i
                                        class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="remake()"><i
                                        class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                        <ul class="tow" style="display: none;">
                            <li>
                                <p style="width: 90px !important;">供应商名称：</p>
                                <select id="supplierId" name="supplierId" class="form-control">
                                    <option value="">请选择</option>
                                    <option th:each="name : ${supplierNames}" th:text="${name.dictLabel}"
                                            th:value="${name.dictCode}"></option>
                                </select>
                            </li>
                            <li>
                                <p style="width: 90px !important;">物料名称：</p>
                                <select id="materId" name="materId" class="form-control noselect2">

                                </select>
                            </li>
                            <li>
                                <p style="width: 90px !important;">截止月份：</p>
                                <input type="text" class="form-control" id="actualMonthStartTime"
                                       name="params[actualMonthStartTime]"
                                       placeholder="开始月份"/>
                            </li>

                            <li>
                                <input type="text" class="form-control" id="actualMonthEndTime"
                                       name="params[actualMonthEndTime]"
                                       placeholder="结束月份"/>
                            </li>

                            <li>
                                <p style="width: 90px !important;">规格型号：</p>
                                <input type="text" class="form-control" name="model" id="model"/>
                            </li>

                            <li style="margin-left: 50px">
                                <a class="btn btn-primary btn-rounded btn-sm search"
                                   onclick="searchList('mater-table')"><i
                                        class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="remake()"><i
                                        class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                        <ul class="three" style="display: none;">
                            <li>
                                <p style="width: 90px !important;">出租单位：</p>
                                <select id="rentalId" name="rentalId" class="form-control">
                                    <option value="">请选择</option>
                                    <option th:each="name : ${rentalNames}" th:text="${name.dictLabel}"
                                            th:value="${name.dictCode}"></option>
                                </select>
                            </li>
                            <li>
                                <p style="width: 90px !important;">物料名称：</p>
                                <select id="machineryNumberId" name="machineryNumberId" class="form-control noselect2"
                                        required>

                                </select>
                            </li>
                            <li>
                                <p style="width: 90px !important;">实际月份：</p>
                                <input type="text" class="form-control" id="actualMonthListStartTime"
                                       name="params[actualMonthListStartTime]"
                                       placeholder="开始月份"/>
                            </li>

                            <li>
                                <input type="text" class="form-control" id="actualMonthListEndTime"
                                       name="params[actualMonthListEndTime]"
                                       placeholder="结束月份"/>
                            </li>
                            <li style="margin-left: 50px">
                                <a class="btn btn-primary btn-rounded btn-sm search"
                                   onclick="searchList('mechanics-day')"><i
                                        class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="remake()"><i
                                        class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <div class="tabs-container">
                    <ul class="nav nav-tabs">
                        <li class="active administration">
                            <a data-toggle="tab" href="#tab-0"
                               aria-expanded="true">管理费用</a></li>
                        <li class="outsource">
                            <a data-toggle="tab" href="#tab-1" aria-expanded="false">分包班组费用</a></li>
                        <li class="mater"><a data-toggle="tab" href="#tab-2" aria-expanded="false">材料费用</a></li>
                        <li class="mechanics"><a data-toggle="tab" href="#tab-3" aria-expanded="false">机械费用</a></li>
                    </ul>
                    <div class="tab-content">
                        <div id="tab-0" class="tab-pane active">
                            <div class="col-sm-12 select-table table-striped">
                                <div class="btn-group-sm" id="toolbar0" role="group">
                                    <a class="btn btn-success add"
                                       onclick="addView($('#companyId').val(),$('#proId').val(),$('#programName').val(),'administration')">
                                        <i class="fa fa-plus"></i> 新增
                                    </a>
                                    <a class="btn btn-primary single edit" onclick="edit('administration')">
                                        <i class="fa fa-edit"></i> 修改
                                    </a>
                                    <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()">
                                        <i class="fa fa-remove"></i> 删除
                                    </a>

                                    <a class="btn btn-warning" onclick="$.table.exportExcel()">
                                        <i class="fa fa-download"></i> 导出
                                    </a>
                                </div>
                                <table id="administration-table"></table>
                            </div>
                        </div>
                        <div id="tab-1" class="tab-pane">
                            <div class="col-sm-12 select-table table-striped">
                                <div class="btn-group-sm" id="toolbar1" role="group">
                                    <a class="btn btn-success add"
                                       onclick="addView($('#companyId').val(),$('#proId').val(),$('#programName').val(),'outsource')">
                                        <i class="fa fa-plus"></i> 新增
                                    </a>
                                    <a class="btn btn-primary single edit" onclick="edit('outsource')">
                                        <i class="fa fa-edit"></i> 修改
                                    </a>
                                    <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()">
                                        <i class="fa fa-remove"></i> 删除
                                    </a>

                                    <a class="btn btn-warning" onclick="$.table.exportExcel()">
                                        <i class="fa fa-download"></i> 导出
                                    </a>
                                </div>
                                <table id="outsource-table"></table>
                            </div>
                        </div>
                        <div id="tab-2" class="tab-pane">
                            <div class="col-sm-12 select-table table-striped">
                                <div class="btn-group-sm" id="toolbar2" role="group">
                                    <a class="btn btn-success add"
                                       onclick="addView($('#companyId').val(),$('#proId').val(),$('#programName').val(),'mater')">
                                        <i class="fa fa-plus"></i> 新增
                                    </a>
                                    <a class="btn btn-primary single edit" onclick="edit('mater')">
                                        <i class="fa fa-edit"></i> 修改
                                    </a>
                                    <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()">
                                        <i class="fa fa-remove"></i> 删除
                                    </a>

                                    <a class="btn btn-warning" onclick="$.table.exportExcel()">
                                        <i class="fa fa-download"></i> 导出
                                    </a>

                                    <a class="btn btn-info" id="materUpload" onclick="importExcels('mater')">
                                        <i class="fa fa-upload"></i> 导入
                                    </a>
                                </div>
                                <table id="mater-table"></table>
                            </div>
                        </div>
                        <div id="tab-3" class="tab-pane">
                            <div class="col-sm-12 select-table table-striped">
                                <ul class="nav nav-tabs" style="margin-top: 10px;">
                                    <li class="active mechanics-day">
                                        <a data-toggle="tab" href="#tabSun-0"
                                           aria-expanded="true">包时机械</a>
                                    </li>
                                    <li class="mechanics-month">
                                        <a data-toggle="tab" href="#tabSun-1"
                                           aria-expanded="false">包月机械</a>
                                    </li>
                                </ul>
                                <div class="tab-content">
                                    <div id="tabSun-0" class="tab-pane active">
                                        <div class="btn-group-sm" id="toolbar3" role="group">
                                            <a class="btn btn-success add"
                                               onclick="addView($('#companyId').val(),$('#proId').val(),$('#programName').val(),'mechanics-day')">
                                                <i class="fa fa-plus"></i> 新增
                                            </a>
                                            <a class="btn btn-primary single edit" onclick="edit('mechanics-day')">
                                                <i class="fa fa-edit"></i> 修改
                                            </a>
                                            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()">
                                                <i class="fa fa-remove"></i> 删除
                                            </a>

                                            <a class="btn btn-warning" onclick="$.table.exportExcel()">
                                                <i class="fa fa-download"></i> 导出
                                            </a>
                                            <a class="btn btn-info" id="machineryUpload" onclick="importExcels('machinery')">
                                                <i class="fa fa-upload"></i> 导入
                                            </a>
                                        </div>
                                        <table id="mechanics-day"></table>
                                    </div>
                                    <div id="tabSun-1" class="tab-pane">
                                        <div class="btn-group-sm" id="toolbar4" role="group">
                                            <a class="btn btn-success add"
                                               onclick="addView($('#companyId').val(),$('#proId').val(),$('#programName').val(),'mechanics')">
                                                <i class="fa fa-plus"></i> 新增
                                            </a>
                                            <a class="btn btn-primary single edit" onclick="edit('mechanics-month')">
                                                <i class="fa fa-edit"></i> 修改
                                            </a>
                                            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()">
                                                <i class="fa fa-remove"></i> 删除
                                            </a>

                                            <a class="btn btn-warning" onclick="$.table.exportExcel()">
                                                <i class="fa fa-download"></i> 导出
                                            </a>
                                            <a class="btn btn-info" id="machineryMonthUpload" onclick="importExcels('machineryMonth')">
                                                <i class="fa fa-upload"></i> 导入
                                            </a>
                                        </div>
                                        <table id="mechanics-month"></table>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: layout-latest-js"/>
<th:block th:include="include :: ztree-js"/>
<th:block th:include="include :: datetimepicker-js"/>
<th:block th:include="include :: bootstrap-suggest-js"/>
<th:block th:include="include :: bootstrap-typeahead-js"/>
<th:block th:include="include :: select2-js" />
<script th:inline="javascript">

    /* 模块前缀url */
    var prefix = ctx + "manage";
    var ids;

    /* 初始化方法 */
    $(function () {
        var panehHidden = false;
        if ($(this).width() < 769) {
            panehHidden = true;
        }
        $('body').layout({initClosed: panehHidden, west__size: 300});

        // 隐藏添加按钮
        $('.add').hide();
        $('.edit').hide();
        $("#materUpload").hide();
        $("#machineryUpload").hide();
        $("#machineryMonthUpload").hide();
        // 初始化列表
        queryList();
        outsourceList();
        materList();
        machineryDayList();
        machineryMonthList();
        // 初始化树组件
        queryProjectTree();

        formatDate();

        $(".administration").click(function () {
            $(".one").show();
            $(".tow").hide();
            $(".three").hide();
            remake();
        });
        $(".outsource").click(function () {
            $(".one").show();
            $(".tow").hide();
            $(".three").hide();
            remake();
        });
        $(".mater").click(function () {
            $(".one").hide();
            $(".tow").show();
            $(".three").hide();
        });
        $(".mechanics").click(function () {
            $(".one").hide();
            $(".tow").hide();
            $(".three").show();
        });
        $(".mechanics-day").click(function () {
            remake();
        });
        $(".mechanics-month").click(function () {
            remake();
        });

        $("#supplierId").change(function () {
            if ($("#supplierId").val() != "") {
                $.ajax({
                    url: prefix + '/selectMaterNameByCode?dictCode=' + $("#supplierId").val(),
                    success: function (data) {
                        $("#materId").empty();
                        for (var i = 0; i < data.materNames.length; i++) {
                            $("#materId").append('<option value="' + data.materNames[i].id + '">' + data.materNames[i].lable + '</option>');
                        }
                    }
                })
            } else {
                $("#materId").empty();
            }

        });
        $("#rentalId").change(function () {
            if ($("#rentalId").val() != "") {
                $.ajax({
                    url: prefix + '/selectMaterNameByCode?dictCode=' + $("#rentalId").val(),
                    success: function (data) {
                        $("#machineryNumberId").empty();
                        for (var i = 0; i < data.materNames.length; i++) {
                            $("#machineryNumberId").append('<option value="' + data.materNames[i].id + '">' + data.materNames[i].lable + '</option>');
                        }
                    }
                })
            } else {
                $("#machineryNumberId").empty();
            }

        });
    });

    /* 初始化 管理费用 */
    function queryList() {
        var options = {
            id: "administration-table",
            toolbar: "toolbar0",
            uniqueId: "manageId",
            url: prefix + "/list",
            createUrl: prefix + "/add{id}",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            pagination: false,
            importTemplateUrl: prefix + "/importTemplate",
            modalName: "市政收入运营报表",
            columns: [
                [{
                    checkbox: true,
                    valign: "middle",
                    align: 'center',
                    rowspan: 2,
                    colspan: 1,
                }, {
                    field: 'companyName',
                    valign: "middle",
                    align: 'center',
                    title: '工程公司',
                    rowspan: 2,
                    colspan: 1,
                }, {
                    field: 'programName',
                    valign: "middle",
                    align: 'center',
                    title: '项目名称',
                    rowspan: 2,
                    colspan: 1,
                }, {
                    field: 'actualMonth',
                    valign: "middle",
                    align: 'center',
                    title: '月份',
                    rowspan: 2,
                    colspan: 1,
                }, {
                    field: 'laborCost',
                    valign: "middle",
                    align: 'center',
                    title: '人工费',
                    rowspan: 2,
                    colspan: 1,
                }, {
                    align: 'center',
                    title: '其他直接费',
                    rowspan: 1,
                    colspan: 8,
                }, {
                    align: 'center',
                    title: '间接费',
                    rowspan: 1,
                    colspan: 12,
                }, {
                    align: 'center',
                    title: '行政费',
                    rowspan: 1,
                    colspan: 9,
                }, {
                    align: 'center',
                    title: '人力费用',
                    rowspan: 1,
                    colspan: 4,
                }],
                [{
                    field: 'directTotal',
                    align: 'center',
                    title: '直接费总计',
                    rowspan: 1,
                    colspan: 1,
                }, {
                    field: 'tempFacilitiesCost',
                    align: 'center',
                    title: '临时设施费',
                    rowspan: 1,
                    colspan: 1,
                }, {
                    field: 'safetyMeasuresCost',
                    align: 'center',
                    title: '安全措施费',
                    rowspan: 1,
                    colspan: 1,
                }, {
                    field: 'waterEleCost',
                    align: 'center',
                    title: '水电费',
                    rowspan: 1,
                    colspan: 1,
                }, {
                    field: 'testCost',
                    align: 'center',
                    title: '实验检测费',
                    rowspan: 1,
                    colspan: 1,
                }, {
                    field: 'secHandCost',
                    align: 'center',
                    title: '二次搬运费',
                    rowspan: 1,
                    colspan: 1,
                }, {
                    field: 'constructCost',
                    align: 'center',
                    title: '报建费',
                    rowspan: 1,
                    colspan: 1,
                }, {
                    field: 'otherCost',
                    align: 'center',
                    title: '其他直接费',
                    rowspan: 1,
                    colspan: 1,
                }, {
                    field: 'indirectTotal',
                    align: 'center',
                    title: '间接费总计',
                    rowspan: 1,
                    colspan: 1,
                }, {
                    field: 'industrialInjuryCost',
                    align: 'center',
                    title: '工伤补助费',
                    rowspan: 1,
                    colspan: 1,
                }, {
                    field: 'projectMainCost',
                    align: 'center',
                    title: '工程维修费',
                    rowspan: 1,
                    colspan: 1,
                }, {
                    field: 'punishmentCost',
                    align: 'center',
                    title: '罚没支出',
                    rowspan: 1,
                    colspan: 1,
                }, {
                    field: 'laborProtectCost',
                    align: 'center',
                    title: '劳动保护费',
                    rowspan: 1,
                    colspan: 1,
                }, {
                    field: 'materialConsumpCost',
                    align: 'center',
                    title: '物料消耗费',
                    rowspan: 1,
                    colspan: 1,
                }, {
                    field: 'consumCost',
                    align: 'center',
                    title: '低值易耗品摊销',
                    rowspan: 1,
                    colspan: 1,
                }, {
                    field: 'legalCost',
                    align: 'center',
                    title: '诉讼费',
                    rowspan: 1,
                    colspan: 1,
                }, {
                    field: 'financialCost',
                    align: 'center',
                    title: '财务费用',
                    rowspan: 1,
                    colspan: 1,
                }, {
                    field: 'agencyCost',
                    align: 'center',
                    title: '中介机构',
                    rowspan: 1,
                    colspan: 1,
                }, {
                    field: 'depreciationCharge',
                    align: 'center',
                    title: '折旧费',
                    rowspan: 1,
                    colspan: 1,
                }, {
                    field: 'otherOverhead',
                    align: 'center',
                    title: '其他间接费',
                    rowspan: 1,
                    colspan: 1,
                }, {
                    field: 'adminTotal',
                    align: 'center',
                    title: '行政总计',
                    rowspan: 1,
                    colspan: 1,
                }, {
                    field: 'travelCost',
                    align: 'center',
                    title: '差旅费',
                    rowspan: 1,
                    colspan: 1,
                }, {
                    field: 'officeCost',
                    align: 'center',
                    title: '办公费',
                    rowspan: 1,
                    colspan: 1,
                }, {
                    field: 'welfareUser',
                    align: 'center',
                    title: '福利费-管理人员',
                    rowspan: 1,
                    colspan: 1,
                }, {
                    field: 'welfareMani',
                    align: 'center',
                    title: '水电食堂-机械手',
                    rowspan: 1,
                    colspan: 1,
                }, {
                    field: 'welfareSupervisor',
                    align: 'center',
                    title: '招待费-监理',
                    rowspan: 1,
                    colspan: 1,
                }, {
                    field: 'entertainmentCost',
                    align: 'center',
                    title: '招待费',
                    rowspan: 1,
                    colspan: 1,
                }, {
                    field: 'giftCost',
                    align: 'center',
                    title: '礼品领用',
                    rowspan: 1,
                    colspan: 1,
                }, {
                    field: 'vehicleCost',
                    align: 'center',
                    title: '车辆使用费',
                    rowspan: 1,
                    colspan: 1,
                }, {
                    field: 'manpowerTotal',
                    align: 'center',
                    title: '人力总计',
                    rowspan: 1,
                    colspan: 1,
                }, {
                    field: 'personSalary',
                    align: 'center',
                    title: '人员薪资',
                    rowspan: 1,
                    colspan: 1,
                }, {
                    field: 'security',
                    align: 'center',
                    title: '社保',
                    rowspan: 1,
                    colspan: 1,
                }, {
                    field: 'accumulation',
                    align: 'center',
                    title: '公积金',
                    rowspan: 1,
                    colspan: 1,
                },
                ]

            ]
        };
        $.table.init(options);
    }

    /* 初始化 分包分组 */
    function outsourceList() {
        var options = {
            id: "outsource-table",
            toolbar: "toolbar1",
            uniqueId: "teamId",
            url: prefix + "/listTeam",
            createUrl: prefix + "/add{id}",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/removeTeam",
            exportUrl: prefix + "/exportTeam",
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            pagination: false,
            modalName: "市政收入运营报表",
            columns: [
                {
                    checkbox: true,
                    valign: "middle",
                    align: 'center',
                }, {
                    field: 'companyName',
                    align: 'center',
                    title: '工程公司',
                    valign: "middle",
                }, {
                    field: 'programName',
                    align: 'center',
                    title: '项目名称',
                    valign: "middle",
                }, {
                    field: 'actualMonth',
                    align: 'center',
                    title: '月份',
                    valign: "middle",
                }, {
                    field: 'teamName',
                    align: 'center',
                    title: '班组名称',
                    valign: "middle",
                }, {
                    field: 'teamCost',
                    align: 'center',
                    title: '班组费用(元)',
                    valign: "middle",
                }, {
                    field: 'workContent',
                    align: 'center',
                    title: '工作内容',
                    valign: "middle",
                }, {
                    field: 'taxRate',
                    align: 'center',
                    title: '税率(%)',
                    valign: "middle",
                }, {
                    field: 'remark',
                    align: 'center',
                    title: '备注',
                    valign: "middle",
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value, 4, "open");
                    }
                }, {
                    field: 'createTime',
                    align: 'center',
                    title: '创建时间',
                }, {
                    field: 'creater',
                    align: 'center',
                    title: '创建人',
                }
            ]
        };
        $.table.init(options);
    }

    /* 初始化 材料费用 */
    function materList() {
        var options = {
            id: "mater-table",
            url: prefix + "/listMater",
            removeUrl: prefix + "/removeMater",
            uniqueId: "materialId",
            toolbar: "toolbar2",
            exportUrl: prefix + "/exportMater",
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            detailView: true,
            modalName: "材料费用报表",
            detailFormatter: function (index, row, $detail) {
                initChildTable(index, row, $detail);
                setTimeout(function () {
                    var sum = 0;
                    for (var i = 0; i < $("#mater" + index).bootstrapTable('getData').length; i++) {
                        sum += Number($("#mater" + index).bootstrapTable('getData')[i].purchaseQuantity);
                    }
                    $(".sum" + index).text("采购数量总计：" + sum.toFixed(2));
                }, 200)
            },
            columns: [{
                checkbox: true,
                valign: "middle",
                align: 'center',
            }, {
                field: 'companyName',
                valign: "middle",
                align: 'center',
                title: '工程公司'
            }, {
                field: 'programName',
                valign: "middle",
                align: 'center',
                title: '项目名称'
            }, {
                field: 'supplierIdName',
                valign: "middle",
                align: 'center',
                title: '供应商名称'
            }, {
                field: 'actualMonth',
                valign: "middle",
                align: 'center',
                title: '截止月份'
            }, {
                field: 'materName',
                valign: "middle",
                align: 'center',
                title: '物料名称'
            }, {
                field: 'model',
                valign: "middle",
                align: 'center',
                title: '规格型号'
            }, {
                field: 'unitName',
                valign: "middle",
                align: 'center',
                title: '单位'
            }, {
                field: 'taxRate',
                valign: "middle",
                align: 'center',
                title: '税率'
            }, {
                field: 'unitPriceTax',
                valign: "middle",
                align: 'center',
                title: '含税单价'
            }, {
                field: 'purchaseQuantity',
                valign: "middle",
                align: 'center',
                title: '累计</br>采购数量'
            }, {
                field: 'amountIncludingTax',
                valign: "middle",
                align: 'center',
                title: '累计</br>含税金额'
            }, {
                field: 'amountIncluding',
                valign: "middle",
                align: 'center',
                title: '累计</br>不含税金额'
            }, {
                field: 'taxes',
                valign: "middle",
                align: 'center',
                title: '税金'
            }, {
                field: 'previousTotalConsume',
                valign: "middle",
                align: 'center',
                title: '截止上期</br>累计消耗量'
            }, {
                field: 'previousTotalPrice',
                valign: "middle",
                align: 'center',
                title: '截止上期</br>累计消耗金额'
            }, {
                field: 'currentSurplus',
                valign: "middle",
                align: 'center',
                title: '本期</br>剩余量'
            }, {
                field: 'currentRemainPrice',
                valign: "middle",
                align: 'center',
                title: '本期</br>剩余金额',
            }, {
                field: 'currentConsump',
                valign: "middle",
                align: 'center',
                title: '本期</br>消耗量'
            }, {
                field: 'currentConsumptionAmount',
                valign: "middle",
                align: 'center',
                title: '本期</br>消耗金额'
            }, {
                field: 'cumulativeConsumption',
                valign: "middle",
                align: 'center',
                title: '累计</br>消耗量'
            }, {
                field: 'accumulatedConsumptionAmount',
                valign: "middle",
                align: 'center',
                title: '累计</br>消耗金额'
            }, {
                field: 'remark',
                valign: "middle",
                align: 'center',
                title: '备注',
                formatter: function (value, row, index) {
                    return $.table.tooltip(value, 4);
                }
            }]
        };
        $.table.init(options);
    }

    //初始化 机械费用(日)
    function machineryDayList() {
        var options = {
            id: "mechanics-day",
            toolbar: "toolbar3",
            uniqueId: "machineryId",
            url: prefix + "/listMachinery",
            createUrl: prefix + "/add{id}",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/removeMachinery",
            exportUrl: prefix + "/exportMachinery",
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            pagination: false,
            detailView: true,
            detailFormatter: function (index, row, $detail) {
                machineryDayChildTable(index, row, $detail);
                setTimeout(function () {
                    var workTimeDaySum = 0;
                    var fuelDayConsumpSum = 0;
                    for (var i = 0; i < $("#mechanics-day-sun" + index).bootstrapTable('getData').length; i++) {
                        workTimeDaySum += Number($("#mechanics-day-sun" + index).bootstrapTable('getData')[i].workTimeDay);
                        fuelDayConsumpSum += Number($("#mechanics-day-sun" + index).bootstrapTable('getData')[i].fuelDayConsump);
                    }
                    $(".mechanics-day-sum" + index).text("当天工作时间总计：" + workTimeDaySum + "  当天加油量总计" + fuelDayConsumpSum);
                }, 200)
            },
            modalName: "包时机械费用报表",
            columns: [
                {
                    checkbox: true,
                    valign: "middle",
                    align: 'center',
                },
                {
                    field: 'companyName',
                    align: 'center',
                    title: '工程公司',
                    valign: "middle",
                },
                {
                    field: 'programName',
                    align: 'center',
                    title: '项目名称',
                    valign: "middle",
                }, {
                    field: 'actualMonth',
                    valign: "middle",
                    align: 'center',
                    title: '实际月份'
                }, {
                    field: 'rentalIdName',
                    align: 'center',
                    title: '出租单位',
                    valign: "middle",
                },
                {
                    field: 'taxRate',
                    align: 'center',
                    title: '税率',
                    valign: "middle",
                },
                {
                    field: 'machineryNumberIdName',
                    align: 'center',
                    title: '机械编号',
                    valign: "middle",
                },
                {
                    field: 'entryTime',
                    align: 'center',
                    title: '进场时间',
                    valign: "middle",
                }, {
                    field: 'rentalUnitPrice',
                    align: 'center',
                    title: '租赁单价</br>（元/小时）',
                    valign: "middle",
                }, {
                    field: 'workTime',
                    align: 'center',
                    title: '工作时间</br>（小时）',
                    valign: "middle",
                }, {
                    field: 'machineryUsageFee',
                    align: 'center',
                    title: '机械使用费</br>（元）',
                    valign: "middle",
                }, {
                    field: 'fuelMonthConsump',
                    align: 'center',
                    title: '本月加油量</br>（L）',
                    valign: "middle",
                }, {
                    field: 'dieselUnitPrice',
                    align: 'center',
                    title: '柴油单价</br>（元/L）',
                    valign: "middle",
                }, {
                    field: 'dieselPrice',
                    align: 'center',
                    title: '油费（元）',
                    valign: "middle",
                },
                {
                    field: 'deductionExpense',
                    align: 'center',
                    title: '需扣除费用',
                    valign: "middle",
                },
                {
                    field: 'totalMonthPrice',
                    align: 'center',
                    title: '本月费用合计',
                    valign: "middle",
                },
                {
                    field: 'monthEndFuelConsumption',
                    align: 'center',
                    title: '月末加油量</br>（L）',
                    valign: "middle",
                },

                {
                    field: 'monthAverageFuel',
                    align: 'center',
                    title: '本月平均油耗 </br>（L/小时）',
                    valign: "middle",
                }, {
                    field: 'exitTime',
                    align: 'center',
                    title: '退场时间 ',
                    valign: "middle",
                }, {
                    field: 'remark',
                    align: 'center',
                    title: '备注 ',
                    valign: "middle",
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value, 4);
                    }
                },
            ]
        };
        $.table.init(options);
    }

    //初始化 机械费用(月)
    function machineryMonthList() {
        var options = {
            id: "mechanics-month",
            toolbar: "toolbar4",
            uniqueId: "machineryId",
            url: prefix + "/listMachineryMonth",
            createUrl: prefix + "/add{id}",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/removeMachineryMonth",
            exportUrl: prefix + "/exportMachineryMonth ",
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            pagination: false,
            detailView: true,
            detailFormatter: function (index, row, $detail) {
                machineryMonthChildTable(index, row, $detail);
                setTimeout(function () {
                    var workTimeDaySum = 0;
                    var fuelDayConsumpSum = 0;
                    for (var i = 0; i < $("#mechanics-month-sun" + index).bootstrapTable('getData').length; i++) {
                        workTimeDaySum += Number($("#mechanics-month-sun" + index).bootstrapTable('getData')[i].workTimeDay);
                        fuelDayConsumpSum += Number($("#mechanics-month-sun" + index).bootstrapTable('getData')[i].fuelDayConsump);
                    }
                    $(".mechanics-month-sum" + index).text("当天工作时间总计：" + workTimeDaySum + "  当天加油量总计" + fuelDayConsumpSum);
                }, 200)
            },
            modalName: "包月机械费用报表",
            columns: [
                {
                    checkbox: true,
                    valign: "middle",
                    align: 'center',
                },
                {
                    field: 'companyName',
                    align: 'center',
                    title: '工程公司',
                    valign: "middle",
                },
                {
                    field: 'programName',
                    align: 'center',
                    title: '项目名称',
                    valign: "middle",
                }, {
                    field: 'actualMonth',
                    valign: "middle",
                    align: 'center',
                    title: '实际月份'
                }, {
                    field: 'rentalIdName',
                    align: 'center',
                    title: '出租单位',
                    valign: "middle",
                },
                {
                    field: 'taxRate',
                    align: 'center',
                    title: '税率',
                    valign: "middle",
                },
                {
                    field: 'machineryNumberIdName',
                    align: 'center',
                    title: '机械编号',
                    valign: "middle",
                },
                {
                    field: 'entryTime',
                    align: 'center',
                    title: '进场时间',
                    valign: "middle",
                }, {
                    field: 'rentalUnitPrice',
                    align: 'center',
                    title: '租赁单价</br>（元/月）',
                    valign: "middle",
                }, {
                    field: 'workTime',
                    align: 'center',
                    title: '工作时间</br>（天）',
                    valign: "middle",
                }, {
                    field: 'deductionExpense',
                    align: 'center',
                    title: '需扣除费用',
                    valign: "middle",
                }, {
                    field: 'machineryUsageFee',
                    align: 'center',
                    title: '机械使用费</br>（元）',
                    valign: "middle",
                }, {
                    field: 'fuelMonthConsump',
                    align: 'center',
                    title: '本月加油量</br>（L）',
                    valign: "middle",
                }, {
                    field: 'dieselUnitPrice',
                    align: 'center',
                    title: '柴油单价</br>（元/L）',
                    valign: "middle",
                }, {
                    field: 'dieselPrice',
                    align: 'center',
                    title: '油费（元）',
                    valign: "middle",
                }, {
                    field: 'totalMonthPrice',
                    align: 'center',
                    title: '本月费用合计',
                    valign: "middle",
                },
                // {
                //     field: 'lastMonthSurplusDiesel',
                //     align: 'center',
                //     title: '上月剩余油量</br>（L）',
                //     valign: "middle",
                // }, {
                //     field: 'currentMonthSurplusDiesel',
                //     align: 'center',
                //     title: '本月剩余油量</br>（L）',
                //     valign: "middle",
                // },

                {
                    field: 'monthEndFuelConsumption',
                    align: 'center',
                    title: '月末加油量</br>（L）',
                    valign: "middle",
                },
                {
                    field: 'monthAverageFuel',
                    align: 'center',
                    title: '本月平均油耗 </br>（L/小时）',
                    valign: "middle",
                }, {
                    field: 'exitTime',
                    align: 'center',
                    title: '退场时间 ',
                    valign: "middle",
                }, {
                    field: 'remark',
                    align: 'center',
                    title: '备注 ',
                    valign: "middle",
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value, 4);
                    }
                },
            ]
        };
        $.table.init(options);
    }

    /* 初始化 树组件 */
    function queryProjectTree() {
        var fix = ctx + "danManage";
        var url = fix + "/treeData";
        var options = {
            url: url,
            expandLevel: 0,
            onClick: zOnClick
        };
        $.tree.init(options);

        function zOnClick(event, treeId, treeNode) {
            if (treeNode.grade == 1) {
                $("#companyId").val(treeNode.id);
                $("#proId").val("");
                $('.add').hide();
                $('.edit').hide();
                $("#materUpload").hide();
                $("#machineryUpload").hide();
                $("#machineryMonthUpload").hide();
                $("#programId").val("");
                $("#programName").val("");
                refresh();
            } else if (treeNode.grade == 2) {
                $("#companyId").val(treeNode.pId);
                $("#proId").val(treeNode.id);
                $("#programId").val(treeNode.id);
                $("#programName").val(treeNode.name);
                $('.add').show();
                $('.edit').show();
                $("#materUpload").show();
                $("#machineryUpload").show();
                $("#machineryMonthUpload").show();
                refresh();
            }
        }
    }

    //材料费用子表格
    initChildTable = function (index, row, $detail) {
        var childTable = $detail.html(
            '<form id="mater-form' + index + '"><div class="select-list"><ul>' +
            '<input type="hidden" name="materialId" value=' + row.materialId + '>' +
            ' <li>' +
            '     <p style="width: 90px !important;">创建时间：</p>' +
            '     <input type="text" class="form-control" id="start' + index + '" name="params[beginTime]"' +
            '            placeholder="开始时间"/>' +
            ' </li>' +
            ' <li>' +
            '     <input type="text" class="form-control" id="end' + index + '" name="params[endTime]"' +
            '            placeholder="结束时间"/>' +
            ' </li>' +
            ' <li style="margin-left: 50px">' +
            '     <a class="btn btn-primary btn-rounded btn-sm" id="search' + index + '" ' +
            '        onclick="searchView(\'mater-form\', \'mater\',' + index + ',\'mater\')"><i' +
            '             class="fa fa-search"></i>&nbsp;搜索</a>' +
            '     <a class="btn btn-warning btn-rounded btn-sm" onclick="reset(' + index + ',\'mater\')"><i' +
            '             class="fa fa-refresh"></i>&nbsp;重置</a>' +
            ' </li>' +
            '</ul></div>' +
            '<div class="btn-group-sm" id="toolbar3" style="margin-top: 3px;" role="group">' +
            ' <a class="btn btn-success add"' +
            '    onclick="addSunView(' + row.materialId + ',' + index + ',\'mater\')">' +
            '     <i class="fa fa-plus"></i> 新增' +
            ' </a>' +
            ' <a class="btn btn-primary single edit disabled" onclick="editSunView(' + row.materialId + ',' + index + ',\'mater\')">' +
            '     <i class="fa fa-edit"></i> 修改' +
            ' </a>' +
            ' <a class="btn btn-warning" onclick="exportExcel(' + row.materialId + ',' + index + ',\'mater\')">' +
            '     <i class="fa fa-download"></i> 导出' +
            ' </a>' +
            '<a class="btn btn-info" onclick="importExcel(' + row.materialId + ',\'mater\')">' +
            '      <i class="fa fa-upload"></i> 导入' +
            '     </a>' +
            ' <a class="btn btn-danger multiple remove disabled" onclick="removeView(' + row.materialId + ',' + index + ',\'mater\')">' +
            '     <i class="fa fa-remove"></i> 删除' +
            ' </a>' +
            '<table id="mater' + index + '"></table>' +
            '<div class="sum' + index + '" style="font-weight: 700;font-size: 14px;color: red;margin-top: 10px;"\'></div>' +
            '</div>' +
            '</form>'
        ).find('table');
        $(childTable).bootstrapTable({
            url: prefix + "/listChildMater",
            method: 'post',
            id: "mater" + index,
            sidePagination: "server",
            toolbar: "toolbar3",
            contentType: "application/x-www-form-urlencoded",
            queryParams: {materialId: row.materialId},
            uniqueId: row.materialId,
            exportUrl: prefix + "/exportChildMater",
            onCheckAll: function () {
                $(".mechanics-remove").removeClass('disabled');
            },
            onUncheckAll: function () {
                $(".mechanics-remove").addClass('disabled');
            },
            onCheck: function (row) {
                if ($("#mater" + index).bootstrapTable('getSelections').length == 1) {
                    $(".edit").removeClass('disabled');
                } else {
                    $(".edit").addClass('disabled');
                    $(".remove").addClass('disabled');
                }
                if ($("#mater" + index).bootstrapTable('getSelections').length > 0) {
                    $(".remove").removeClass('disabled');
                } else {
                    $(".remove").addClass('disabled');
                }
            },
            onUncheck: function (row) {
                if ($("#mater" + index).bootstrapTable('getSelections').length == 1) {
                    $(".edit").removeClass('disabled');
                } else {
                    $(".edit").addClass('disabled');
                }
                if ($("#mater" + index).bootstrapTable('getSelections').length == 0) {
                    $(".remove").addClass('disabled');
                } else {
                    $(".remove").removeClass('disabled');
                }
            },
            columns: [{
                checkbox: true
            },
                {
                    field: 'purchaseDate',
                    valign: "middle",
                    align: 'center',
                    title: '采购日期'
                },
                {
                    field: 'materName',
                    valign: "middle",
                    align: 'center',
                    title: '物料名称'
                },
                {
                    field: 'purchaseQuantity',
                    valign: "middle",
                    align: 'center',
                    title: '采购数量'
                },
                {
                    field: 'unitPriceTax',
                    valign: "middle",
                    align: 'center',
                    title: '含税单价'
                },
                {
                    field: 'model',
                    valign: "middle",
                    align: 'center',
                    title: '规格型号'
                },
            ]
        });
        layui.use('laydate', function () {
            var laydate = layui.laydate;
            var start = laydate.render({
                elem: '#start' + index,
                type: 'date',
                done: function (value, date) {
                    // 结束时间大于开始时间
                    if (value !== '') {
                        end.config.min.year = date.year;
                        end.config.min.month = date.month - 1;
                        end.config.min.date = date.date;
                    } else {
                        end.config.min.year = '';
                        end.config.min.month = '';
                        end.config.min.date = '';
                    }
                }
            });
            var end = laydate.render({
                elem: '#end' + index,
                type: 'date',
                done: function (value, date) {
                    // 开始时间小于结束时间
                    if (value !== '') {
                        start.config.max.year = date.year;
                        start.config.max.month = date.month - 1;
                        start.config.max.date = date.date;
                    } else {
                        start.config.max.year = '';
                        start.config.max.month = '';
                        start.config.max.date = '';
                    }
                }
            });
        });
    };

    //机械费用子表格(日)
    machineryDayChildTable = function (index, row, $detail) {
        var childTable = $detail.html('<form id="mater-form' + index + '"><div class="select-list"><ul>' +
            '<input type="hidden" name="machineryId" value=' + row.machineryId + '>' +
            ' <li>' +
            '     <p style="width: 90px !important;">工作日期：</p>' +
            '     <input type="text" class="form-control" id="start-day' + index + '" name="params[beginTime]"' +
            '            placeholder="工作日期"/>' +
            ' </li>' +
            ' <li>' +
            '     <input type="text" class="form-control" id="end-day' + index + '" name="params[endTime]"' +
            '            placeholder="结束时间"/>' +
            ' <li style="margin-left: 50px">' +
            '     <a class="btn btn-primary btn-rounded btn-sm" id="search-day' + index + '" ' +
            '        onclick="searchView(\'mater-form\', \'mechanics-day-sun\',' + index + ',\'mechanics-day-sun\')"><i' +
            '             class="fa fa-search"></i>&nbsp;搜索</a>' +
            '     <a class="btn btn-warning btn-rounded btn-sm" onclick="reset(' + index + ',\'mechanics-day-sun\')"><i' +
            '             class="fa fa-refresh"></i>&nbsp;重置</a>' +
            ' </li>' +
            '</ul></div>' +
            '<div class="btn-group-sm" id="toolbar4" style="margin-top: 3px;" role="group">' +
            ' <a class="btn btn-success add"' +
            '    onclick="addSunView(' + row.machineryId + ',' + index + ',\'mechanics-day-sun\')">' +
            '     <i class="fa fa-plus"></i> 新增' +
            ' </a>' +
            ' <a class="btn btn-primary single mechanics-edit disabled" onclick="editSunView(' + row.machineryId + ',' + index + ',\'mechanics-day-sun\')">' +
            '     <i class="fa fa-edit"></i> 修改' +
            ' </a>' +
            ' <a class="btn btn-warning" onclick="exportExcel(' + row.machineryId + ',' + index + ',\'mechanics-day-sun\')">' +
            '     <i class="fa fa-download"></i> 导出' +
            ' </a>' +
            '<a class="btn btn-info" onclick="importExcel(' + row.machineryId + ',\'mechanics-day-sun\')">' +
            '      <i class="fa fa-upload"></i> 导入' +
            '     </a>' +
            ' <a class="btn btn-danger multiple mechanics-remove disabled" onclick="removeView(' + row.machineryId + ',' + index + ',\'mechanics-day-sun\')">' +
            '     <i class="fa fa-remove"></i> 删除' +
            ' </a>' +
            '<table id="mechanics-day-sun' + index + '"></table>' +
            '<div class="mechanics-day-sum' + index + '" style="font-weight: 700;font-size: 14px;color: red;margin-top: 10px;"\'></div>' +
            '</div>' +
            '</form>').find('table');
        $(childTable).bootstrapTable({
            url: prefix + "/listChildMachinery",
            method: 'post',
            id: "mechanics-day-sun" + index,
            sidePagination: "server",
            contentType: "application/x-www-form-urlencoded",
            queryParams: {pId: row.machineryId},
            uniqueId: row.machineryId,
            toolbar: "toolbar4",
            onCheckAll: function () {
                $(".mechanics-remove").removeClass('disabled');
            },
            onUncheckAll: function () {
                $(".mechanics-remove").addClass('disabled');
            },
            onCheck: function (row) {
                if ($("#mechanics-day-sun" + index).bootstrapTable('getSelections').length == 1) {
                    $(".mechanics-edit").removeClass('disabled');
                } else {
                    $(".mechanics-edit").addClass('disabled');
                    $(".mechanics-remove").addClass('disabled');
                }
                if ($("#mechanics-day-sun" + index).bootstrapTable('getSelections').length > 0) {
                    $(".mechanics-remove").removeClass('disabled');
                } else {
                    $(".mechanics-remove").addClass('disabled');
                }
            },
            onUncheck: function (row) {
                if ($("#mechanics-day-sun" + index).bootstrapTable('getSelections').length == 1) {
                    $(".mechanics-edit").removeClass('disabled');
                } else {
                    $(".mechanics-edit").addClass('disabled');
                }
                if ($("#mechanics-day-sun" + index).bootstrapTable('getSelections').length == 0) {
                    $(".mechanics-remove").addClass('disabled');
                } else {
                    $(".mechanics-remove").removeClass('disabled');
                }
            },
            columns: [{
                checkbox: true
            },
                {
                    field: 'purchaseDate',
                    align: 'center',
                    title: '工作日期',
                    valign: "middle",
                },
                {
                    field: 'workTimeDay',
                    align: 'center',
                    title: '当天工作时间',
                    valign: "middle",
                }, {
                    field: 'fuelDayConsump',
                    align: 'center',
                    title: '当天加油量',
                    valign: "middle",
                }
            ]
        });
        layui.use('laydate', function () {
            var laydate = layui.laydate;
            var start = laydate.render({
                elem: '#start-day' + index,
                type: 'date',
                done: function (value, date) {
                    // 结束时间大于开始时间
                    if (value !== '') {
                        end.config.min.year = date.year;
                        end.config.min.month = date.month - 1;
                        end.config.min.date = date.date;
                    } else {
                        end.config.min.year = '';
                        end.config.min.month = '';
                        end.config.min.date = '';
                    }
                }
            });
            var end = laydate.render({
                elem: '#end-day' + index,
                type: 'date',
                done: function (value, date) {
                    // 开始时间小于结束时间
                    if (value !== '') {
                        start.config.max.year = date.year;
                        start.config.max.month = date.month - 1;
                        start.config.max.date = date.date;
                    } else {
                        start.config.max.year = '';
                        start.config.max.month = '';
                        start.config.max.date = '';
                    }
                }
            });
        });
    }

    //机械费用子表格(月)
    machineryMonthChildTable = function (index, row, $detail) {
        var childTable = $detail.html('<form id="mater-form' + index + '"><div class="select-list"><ul>' +
            '<input type="hidden" name="machineryId" value=' + row.machineryId + '>' +
            ' <li>' +
            '     <p style="width: 90px !important;">工作日期：</p>' +
            '     <input type="text" class="form-control" id="start-month' + index + '" name="params[beginTime]"' +
            '            placeholder="工作日期"/>' +
            ' </li>' +
            ' <li>' +
            '     <input type="text" class="form-control" id="end-month' + index + '" name="params[endTime]"' +
            '            placeholder="结束时间"/>' +
            ' <li style="margin-left: 50px">' +
            '     <a class="btn btn-primary btn-rounded btn-sm" id="search-month' + index + '" ' +
            '        onclick="searchView(\'mater-form\', \'mechanics-month-sun\',' + index + ',\'mechanics-month-sun\')"><i' +
            '             class="fa fa-search"></i>&nbsp;搜索</a>' +
            '     <a class="btn btn-warning btn-rounded btn-sm" onclick="reset(' + index + ',\'mechanics-month-sun\')"><i' +
            '             class="fa fa-refresh"></i>&nbsp;重置</a>' +
            ' </li>' +
            '</ul></div>' +
            '<div class="btn-group-sm" id="toolbar5" style="margin-top: 3px;" role="group">' +
            ' <a class="btn btn-success add"' +
            '    onclick="addSunView(' + row.machineryId + ',' + index + ',\'mechanics-month-sun\')">' +
            '     <i class="fa fa-plus"></i> 新增' +
            ' </a>' +
            ' <a class="btn btn-primary single mechanics-edit-month disabled" onclick="editSunView(' + row.machineryId + ',' + index + ',\'mechanics-month-sun\')">' +
            '     <i class="fa fa-edit"></i> 修改' +
            ' </a>' +
            ' <a class="btn btn-warning" onclick="exportExcel(' + row.machineryId + ',' + index + ',\'mechanics-month-sun\')">' +
            '     <i class="fa fa-download"></i> 导出' +
            ' </a>' +
            '<a class="btn btn-info" onclick="importExcel(' + row.machineryId + ',\'mechanics-month-sun\')">' +
            '      <i class="fa fa-upload"></i> 导入' +
            '     </a>' +
            ' <a class="btn btn-danger multiple mechanics-remove-month disabled" onclick="removeView(' + row.machineryId + ',' + index + ',\'mechanics-month-sun\')">' +
            '     <i class="fa fa-remove"></i> 删除' +
            ' </a>' +
            '<table id="mechanics-month-sun' + index + '"></table>' +
            '<div class="mechanics-month-sum' + index + '" style="font-weight: 700;font-size: 14px;color: red;margin-top: 10px;"\'></div>' +
            '</div>' +
            '</form>').find('table');
        $(childTable).bootstrapTable({
            url: prefix + "/listChildMachineryMonth",
            method: 'post',
            id: "mechanics-month-sun" + index,
            sidePagination: "server",
            contentType: "application/x-www-form-urlencoded",
            queryParams: {pId: row.machineryId},
            uniqueId: row.machineryId,
            toolbar: "toolbar5",
            onCheckAll: function () {
                $(".mechanics-remove-month").removeClass('disabled');
            },
            onUncheckAll: function () {
                $(".mechanics-remove-month").addClass('disabled');
            },
            onCheck: function (row) {
                if ($("#mechanics-month-sun" + index).bootstrapTable('getSelections').length == 1) {
                    $(".mechanics-edit-month").removeClass('disabled');
                } else {
                    $(".mechanics-edit-month").addClass('disabled');
                    $(".mechanics-remove-month").addClass('disabled');
                }
                if ($("#mechanics-month-sun" + index).bootstrapTable('getSelections').length > 0) {
                    $(".mechanics-remove-month").removeClass('disabled');
                } else {
                    $(".mechanics-remove-month").addClass('disabled');
                }
            },
            onUncheck: function (row) {
                if ($("#mechanics-month-sun" + index).bootstrapTable('getSelections').length == 1) {
                    $(".mechanics-edit-month").removeClass('disabled');
                } else {
                    $(".mechanics-edit-month").addClass('disabled');
                }
                if ($("#mechanics-month-sun" + index).bootstrapTable('getSelections').length == 0) {
                    $(".mechanics-remove-month").addClass('disabled');
                } else {
                    $(".mechanics-remove-month").removeClass('disabled');
                }
            },
            columns: [{
                checkbox: true
            },
                {
                    field: 'purchaseDate',
                    align: 'center',
                    title: '工作日期',
                    valign: "middle",
                },
                {
                    field: 'workTimeDay',
                    align: 'center',
                    title: '当天工作时间',
                    valign: "middle",
                }, {
                    field: 'fuelDayConsump',
                    align: 'center',
                    title: '当天加油量',
                    valign: "middle",
                }
            ]
        });
        layui.use('laydate', function () {
            var laydate = layui.laydate;
            var start = laydate.render({
                elem: '#start-month' + index,
                type: 'date',
                done: function (value, date) {
                    // 结束时间大于开始时间
                    if (value !== '') {
                        end.config.min.year = date.year;
                        end.config.min.month = date.month - 1;
                        end.config.min.date = date.date;
                    } else {
                        end.config.min.year = '';
                        end.config.min.month = '';
                        end.config.min.date = '';
                    }
                }
            });
            var end = laydate.render({
                elem: '#end-month' + index,
                type: 'date',
                done: function (value, date) {
                    // 开始时间小于结束时间
                    if (value !== '') {
                        start.config.max.year = date.year;
                        start.config.max.month = date.month - 1;
                        start.config.max.date = date.date;
                    } else {
                        start.config.max.year = '';
                        start.config.max.month = '';
                        start.config.max.date = '';
                    }
                }
            });
        });
    }

    //子表格搜索
    function searchView(tableName, id, index, type) {
        if (type == 'mater') {
            var tableName = tableName + index;
            var id = id + index;

            $.table.search(tableName, id);
            setTimeout(function () {
                var sum = 0;
                for (var i = 0; i < $("#mater" + index).bootstrapTable('getData').length; i++) {
                    sum += Number($("#mater" + index).bootstrapTable('getData')[i].purchaseQuantity);
                }
                $(".sum" + index).text("采购数量总计：" + sum);
            }, 200)
        } else if (type == 'mechanics-day-sun' || type == 'mechanics-month-sun') {
            if (type == 'mechanics-day-sun') {
                setTimeout(function () {
                    var workTimeDaySum = 0;
                    var fuelDayConsumpSum = 0;
                    for (var i = 0; i < $("#mechanics-day-sun" + index).bootstrapTable('getData').length; i++) {
                        workTimeDaySum += Number($("#mechanics-day-sun" + index).bootstrapTable('getData')[i].workTimeDay);
                        fuelDayConsumpSum += Number($("#mechanics-day-sun" + index).bootstrapTable('getData')[i].fuelDayConsump);
                    }
                    $(".mechanics-day-sum" + index).text("当天工作时间总计：" + workTimeDaySum + "  当天加油量总计" + fuelDayConsumpSum);
                }, 200)
            } else if (type == 'mechanics-month-sun') {
                setTimeout(function () {
                    var workTimeDaySum = 0;
                    var fuelDayConsumpSum = 0;
                    for (var i = 0; i < $("#mechanics-month-sun" + index).bootstrapTable('getData').length; i++) {
                        workTimeDaySum += Number($("#mechanics-month-sun" + index).bootstrapTable('getData')[i].workTimeDay);
                        fuelDayConsumpSum += Number($("#mechanics-month-sun" + index).bootstrapTable('getData')[i].fuelDayConsump);
                    }
                    $(".mechanics-month-sum" + index).text("当天工作时间总计：" + workTimeDaySum + "  当天加油量总计" + fuelDayConsumpSum);
                }, 200)
            }
            var tableName = tableName + index;
            var id = id + index;
            $.table.search(tableName, id);
        }

    }

    //父表格搜索
    function searchList(id) {
        var data;
        if (id == "administration-table" || id == "outsource-table") {
            data = {
                programName: $("#programName").val(),
                'params[beginTime]': $("#startTime").val(),
                'params[endTime]': $("#endTime").val()
            }
            $("#outsource-table").bootstrapTable('refresh', data);
        } else if (id == "mater-table") {
            data = {
                supplierId: $("#supplierId").val(),
                materId: $("#materId").val(),
                model: $("#model").val(),
                'params[actualMonthStartTime]': $("#actualMonthStartTime").val(),
                'params[actualMonthEndTime]': $("#actualMonthEndTime").val()
            }
        } else if (id == 'mechanics-day' || id == 'mechanics-month') {
            data = {
                rentalId: $("#rentalId").val(),
                machineryNumberId: $("#machineryNumberId").val(),
                'params[actualMonthStartListTime]': $("#actualMonthStartListTime").val(),
                'params[actualMonthEndListTime]': $("#actualMonthEndListTime").val()
            }
            $("#mechanics-month").bootstrapTable('refresh', data);
        }

        $("#" + id).bootstrapTable('refresh', data);
    }

    function reset(index, type) {
        if (type == 'mater') {
            $("#start" + index).val('');
            $("#end" + index).val('');
            $("#search" + index).click();
        } else if (type == 'mechanics-day-sun') {
            $("#start-day" + index).val('');
            $("#end-day" + index).val('');
            $("#search-day" + index).click();
        } else {
            $("#start-month" + index).val('');
            $("#end-month" + index).val('');
            $("#search-month" + index).click();
        }
    }

    //搜索重置
    function remake() {
        $.form.reset();
        $("#materId").empty();
        $("#machineryNumberId").empty();
        $(".search").click();
    }

    //导出
    function exportExcel(materialId, index, type) {
        var url;
        var data;
        if (type == 'mater') {
            data = {
                'params[beginTime]': $("#start" + index).val(),
                'params[endTime]': $("#end" + index).val(),
                materialId: materialId,
            };
            url = '/exportChildMater';
        } else if (type == 'mechanics-day-sun') {
            data = {
                'params[beginTime]': $("#start-day" + index).val(),
                'params[endTime]': $("#end-day" + index).val(),
                pId: materialId
            };
            url = '/exportChildMachinery';
        } else if (type == 'mechanics-month-sun') {
            data = {
                'params[beginTime]': $("#start-month" + index).val(),
                'params[endTime]': $("#end-month" + index).val(),
                pId: materialId
            };
            url = '/exportChildMachineryMonth';
        }
        $.modal.confirm("确定导出吗？", function () {
            $.modal.loading("正在导出数据，请稍后...");
            $.post(prefix + url, data, function (result) {
                if (result.code == web_status.SUCCESS) {
                    window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
                } else if (result.code == web_status.WARNING) {
                    $.modal.alertWarning(result.msg)
                } else {
                    $.modal.alertError(result.msg);
                }
                $.modal.closeLoading();
            });
        });

    }

    //父表格添加
    function addView(companyId, proId, programName, type) {
        var urlType;
        if (type == "administration") {
            urlType = 'addView';
        } else if (type == "outsource") {
            urlType = 'addTeamView';
        } else if (type == "mater") {
            urlType = 'addMaterView';
        } else if (type == 'mechanics-day') {
            urlType = 'addMachineryView';
        } else {
            urlType = 'addMachineryViewMonth';
        }
        var url = "/manage/" + urlType + "?companyId=" + companyId + "&programId=" + proId + "&programName=" + programName;
        $.modal.open("添加", url);
    }

    //子表格添加
    function addSunView(materialId, index, type) {
        var url;
        if (type == 'mater') {
            url = "/manage/addViewChildMater?materialId=" + materialId + "&index=" + index;
        } else if (type == 'mechanics-day-sun') {
            url = "/manage/addViewChildMachinery?machineryId=" + materialId + "&index=" + index;
        } else {
            url = "/manage/addViewChildMachineryMonth?machineryId=" + materialId + "&index=" + index;
        }
        $.modal.open("添加", url);
    }

    //子表格修改
    function editSunView(materialId, index, type) {
        var url;
        if (type == 'mater') {
            url = "/manage/editViewChildMater?id=" + $("#mater" + index).bootstrapTable('getSelections')[0].id + "&materialId=" + materialId + "&index=" + index;
        } else if (type == 'mechanics-day-sun') {
            url = "/manage/editViewChildMachinery?pId=" + materialId + "&id=" + $("#mechanics-day-sun" + index).bootstrapTable('getSelections')[0].id + "&index=" + index;
        } else {
            url = "/manage/editViewChildMachineryMonth?pId=" + materialId + "&id=" + $("#mechanics-month-sun" + index).bootstrapTable('getSelections')[0].id + "&index=" + index;
        }
        $.modal.open("修改", url);
    }

    //删除
    function removeView(materialId, index, type) {
        var ids = [];
        if (type == 'mater') {
            for (var i = 0; i < $("#mater" + index).bootstrapTable('getSelections').length; i++) {
                ids.push($("#mater" + index).bootstrapTable('getSelections')[i].id)
            }
            $.ajax({
                url: prefix + '/removeMaterialDay',
                data: {
                    ids: ids.toString(),
                    materialId: materialId
                },
                type: 'POST',
                success: function (data) {
                    $.modal.msgSuccess('删除成功！');
                    refreshSun(index);
                }
            })
        } else if (type == 'mechanics-day-sun') {
            for (var i = 0; i < $("#mechanics-day-sun" + index).bootstrapTable('getSelections').length; i++) {
                ids.push($("#mechanics-day-sun" + index).bootstrapTable('getSelections')[i].id)
            }
            $.ajax({
                url: prefix + '/removeMachineryDay',
                data: {
                    ids: ids.toString(),
                    pId: materialId
                },
                type: 'POST',
                success: function (data) {
                    $.modal.msgSuccess('删除成功！');
                    refreshSun(index);
                }
            })
        } else {
            for (var i = 0; i < $("#mechanics-month-sun" + index).bootstrapTable('getSelections').length; i++) {
                ids.push($("#mechanics-month-sun" + index).bootstrapTable('getSelections')[i].id)
            }
            $.ajax({
                url: prefix + '/removeMachineryDayMonth',
                data: {
                    ids: ids.toString(),
                    pId: materialId
                },
                type: 'POST',
                success: function (data) {
                    $.modal.msgSuccess('删除成功！');
                    refreshSun(index);
                }
            })
        }

    }

    /* 父表格编辑 */
    function edit(type) {
        var tableArray;
        var url;
        if (type == 'administration') {
            tableArray = $("#administration-table").bootstrapTable('getSelections');
            url = prefix + '/editView?manageId=' + tableArray[0].manageId;
        } else if (type == "outsource") {
            tableArray = $("#outsource-table").bootstrapTable('getSelections');
            url = prefix + '/editTeamView?teamId=' + tableArray[0].teamId;
        } else if (type == 'mechanics-day') {
            tableArray = $("#mechanics-day").bootstrapTable('getSelections');
            url = prefix + '/editMachineryView?machineryId=' + tableArray[0].machineryId;
        } else if (type == 'mater') {
            tableArray = $("#mater-table").bootstrapTable('getSelections');
            url = prefix + '/editMaterView?materialId=' + tableArray[0].materialId + "&actualMonth=" + tableArray[0].actualMonth;
        }
        else {
            tableArray = $("#mechanics-month").bootstrapTable('getSelections');
            url = prefix + '/editMachineryViewMonth?machineryId=' + tableArray[0].machineryId;
        }
        $.modal.open("报表编辑", url);
    }

    /* 详情页面 */
    function details(programId, actualMonth) {
        var url = prefix + '/detail?programId=' + programId + "&actualMonth=" + actualMonth;
        $.modal.open("详情", url);
    }

    /* 初始化树组件 > 展开 */
    $('#btnExpand').click(function () {
        $._tree.expandAll(true);
        $(this).hide();
        $('#btnCollapse').show();
    });

    /* 初始化树组件 > 折叠 */
    $('#btnCollapse').click(function () {
        $._tree.expandAll(false);
        $(this).hide();
        $('#btnExpand').show();
    });

    /* 初始化树组件 > 刷新 */
    $('#btnRefresh').click(function () {
        queryProjectTree();
    });

    /*动态详情-详细*/
    function detail(excellenceId) {
        var url = prefix + '/detail/' + excellenceId;
        $.modal.openTab("动态详情", url);
    }

    function refreshSun(index) {
        setTimeout(function () {
            $("#mater" + index).bootstrapTable('refresh');
            $("#mechanics-day-sun" + index).bootstrapTable('refresh');
            $("#mechanics-month-sun" + index).bootstrapTable('refresh');
        }, 200)

    }

    //父表格刷新
    function refresh() {
        setTimeout(function () {
            $("#administration-table").bootstrapTable('refresh');
            $("#outsource-table").bootstrapTable('refresh');
            $("#mater-table").bootstrapTable('refresh');
            $("#mechanics-day").bootstrapTable('refresh');
            $("#mechanics-month").bootstrapTable('refresh');
        }, 200)
    }

    function formatDate() {
        layui.use('laydate', function () {
            var laydate = layui.laydate;
            var startDate = laydate.render({
                elem: '#startTime',
                type: 'month',
                done: function (value, date) {
                    // 结束时间大于开始时间
                    if (value !== '') {
                        endDate.config.min.year = date.year;
                        endDate.config.min.month = date.month - 1;
                        endDate.config.min.date = date.date;
                    } else {
                        endDate.config.min.year = '';
                        endDate.config.min.month = '';
                        endDate.config.min.date = '';
                    }
                }
            });
            var endDate = laydate.render({
                elem: '#endTime',
                type: 'month',
                done: function (value, date) {
                    // 开始时间小于结束时间
                    if (value !== '') {
                        startDate.config.max.year = date.year;
                        startDate.config.max.month = date.month - 1;
                        startDate.config.max.date = date.date;
                    } else {
                        startDate.config.max.year = '';
                        startDate.config.max.month = '';
                        startDate.config.max.date = '';
                    }
                }
            });
            var actualMonthStartTime = laydate.render({
                elem: '#actualMonthStartTime',
                type: 'month',
                done: function (value, date) {
                    // 结束时间大于开始时间
                    if (value !== '') {
                        actualMonthEndTime.config.min.year = date.year;
                        actualMonthEndTime.config.min.month = date.month - 1;
                        actualMonthEndTime.config.min.date = date.date;
                    } else {
                        actualMonthEndTime.config.min.year = '';
                        actualMonthEndTime.config.min.month = '';
                        actualMonthEndTime.config.min.date = '';
                    }
                }
            });
            var actualMonthEndTime = laydate.render({
                elem: '#actualMonthEndTime',
                type: 'month',
                done: function (value, date) {
                    // 开始时间小于结束时间
                    if (value !== '') {
                        actualMonthStartTime.config.max.year = date.year;
                        actualMonthStartTime.config.max.month = date.month - 1;
                        actualMonthStartTime.config.max.date = date.date;
                    } else {
                        actualMonthStartTime.config.max.year = '';
                        actualMonthStartTime.config.max.month = '';
                        actualMonthStartTime.config.max.date = '';
                    }
                }
            });
            var actualMonthListStartTime = laydate.render({
                elem: '#actualMonthListStartTime',
                type: 'month',
                done: function (value, date) {
                    // 结束时间大于开始时间
                    if (value !== '') {
                        actualMonthListEndTime.config.min.year = date.year;
                        actualMonthListEndTime.config.min.month = date.month - 1;
                        actualMonthListEndTime.config.min.date = date.date;
                    } else {
                        actualMonthListEndTime.config.min.year = '';
                        actualMonthListEndTime.config.min.month = '';
                        actualMonthListEndTime.config.min.date = '';
                    }
                }
            });
            var actualMonthListEndTime = laydate.render({
                elem: '#actualMonthListEndTime',
                type: 'month',
                done: function (value, date) {
                    // 开始时间小于结束时间
                    if (value !== '') {
                        actualMonthListStartTime.config.max.year = date.year;
                        actualMonthListStartTime.config.max.month = date.month - 1;
                        actualMonthListStartTime.config.max.date = date.date;
                    } else {
                        actualMonthListStartTime.config.max.year = '';
                        actualMonthListStartTime.config.max.month = '';
                        actualMonthListStartTime.config.max.date = '';
                    }
                }
            });


        });
    }

    //导入
    function importExcel(id, type) {
        var url;
        if (type == 'mechanics-day-sun') {
            url = '/importData';
            ids = ['mechanics-day-sun', 'machineryId'];
        } else if (type == 'mechanics-month-sun') {
            url = '/importDataMonth';
            ids = ['mechanics-month-sun', 'machineryId'];
        } else {
            url = '/importDataMater';
            ids = ['mater', 'materId'];
        }

        layer.open({
            type: 1,
            area: ['400px', '230px'],
            fix: false,
            //不固定
            maxmin: true,
            shade: 0.3,
            title: '每日数据',
            content: $('#importTpl').html(),
            btn: ['<i class="fa fa-check"></i> 导入', '<i class="fa fa-remove"></i> 取消'],
            // 弹层外区域关闭
            shadeClose: true,
            btn1: function (index, layero) {
                var file = layero.find('#file').val();
                if (file == '' || (!$.common.endWith(file, '.xls') && !$.common.endWith(file, '.xlsx'))) {
                    $.modal.msgWarning("请选择后缀为 “xls”或“xlsx”的文件。");
                    return false;
                }
                var index = layer.load(2, {shade: false});
                $.modal.disable();
                var formData = new FormData();
                formData.append("file", $('#file')[0].files[0]);
                formData.append("updateSupport", $("input[name='updateSupport']").is(':checked'));
                $.ajax({
                    url: prefix + url + "?" + ids[1] + "=" + id,
                    data: formData,
                    cache: false,
                    contentType: false,
                    processData: false,
                    type: 'POST',
                    success: function (result) {
                        if (result.code == web_status.SUCCESS) {
                            $.modal.closeAll();
                            $.modal.alertSuccess(result.msg);
                            $.table.refresh();
                        } else if (result.code == web_status.WARNING) {
                            layer.close(index);
                            $.modal.enable();
                            $.modal.alertWarning(result.msg)
                        } else {
                            layer.close(index);
                            $.modal.enable();
                            $.modal.alertError(result.msg);
                        }
                    }
                });
            }
        });
    }

    // 月表导入
    function importExcels(type) {
        var url;
        if (type == 'mater') {
            url = '/importMater';
            ids = ['importMater'];
        } else if (type == 'machinery') {
            url = '/importMachinery';
            ids = ['importMachinery'];
        } else {
            url = '/importMachineryMonth';
            ids = ['importMachineryMonth'];
        }

        layer.open({
            type: 1,
            area: ['400px', '230px'],
            fix: false,
            //不固定
            maxmin: true,
            shade: 0.3,
            title: '每月数据',
            content: $('#importTpls').html(),
            btn: ['<i class="fa fa-check"></i> 导入', '<i class="fa fa-remove"></i> 取消'],
            // 弹层外区域关闭
            shadeClose: true,
            btn1: function (index, layero) {
                var file = layero.find('#files').val();

                if (file == '' || (!$.common.endWith(file, '.xls') && !$.common.endWith(file, '.xlsx'))) {
                    $.modal.msgWarning("请选择后缀为 “xls”或“xlsx”的文件。");
                    return false;
                }
                var index = layer.load(2, {shade: false});
                $.modal.disable();
                var formData = new FormData();
                formData.append("file", $('#files')[0].files[0]);

                var companyId = $("input[name='companyId']").val();
                var programId = $("input[name='programId']").val();
                $.ajax({
                    url: prefix + url + "?companyId=" + companyId + "&programId=" + programId,
                    data: formData,
                    cache: false,
                    contentType: false,
                    processData: false,
                    type: 'POST',
                    success: function (result) {
                        if (result.code == web_status.SUCCESS) {
                            $.modal.closeAll();
                            $.modal.alertSuccess(result.msg);
                            $.table.refresh();
                        } else if (result.code == web_status.WARNING) {
                            layer.close(index);
                            $.modal.enable();
                            $.modal.alertWarning(result.msg)
                        } else {
                            layer.close(index);
                            $.modal.enable();
                            $.modal.alertError(result.msg);
                        }
                    }
                });
            }
        });
    }

    //下载模板
    function importTemplate() {
        var url;
        if (ids[0] == 'mater') {
            url = '/importTemplateMater';
        } else {
            url = '/importTemplate';
        }
        $.get(prefix + url, function (result) {
            if (result.code == web_status.SUCCESS) {
                window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
            } else if (result.code == web_status.WARNING) {
                $.modal.alertWarning(result.msg)
            } else {
                $.modal.alertError(result.msg);
            }
        });
    }

    // 月表下载模板
    function importTemplates(){
        var url;
        if(ids[0] == 'importMater'){
            url = '/importTemplates';
        } else if(ids[0] == 'importMachinery'){
            url = '/importTemplatesMachinery';
        } else {
            url = '/importTemplatesMachineryMonth';
        }
        $.get(prefix + url, function (result) {
            if (result.code == web_status.SUCCESS) {
                window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
            } else if (result.code == web_status.WARNING) {
                $.modal.alertWarning(result.msg)
            } else {
                $.modal.alertError(result.msg);
            }
        });
    }

</script>
</body>
<!-- 日表导入 -->
<script id="importTpl" type="text/template">
    <form enctype="multipart/form-data" class="mt20 mb10">
        <div class="col-xs-offset-1">
            <input type="file" id="file" name="file"/>
            <div class="mt10 pt5">
                <a onclick="importTemplate()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a>
            </div>
            <font color="red" class="pull-left mt10">
                提示：仅允许导入“xls”或“xlsx”格式文件！
            </font>
        </div>
    </form>
</script>

<!-- 月表导入 -->
<script id="importTpls" type="text/template">
    <form enctype="multipart/form-data" class="mt20 mb10">
        <div class="col-xs-offset-1">
            <input type="file" id="files" name="files"/>
            <div class="mt10 pt5">
                <a onclick="importTemplates()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a>
            </div>
            <font color="red" class="pull-left mt10">
                提示：仅允许导入“xls”或“xlsx”格式文件！
            </font>
        </div>
    </form>
</script>
</html>